'''
Created on Oct 21, 2009

@author: kage
'''

from PyBatch.handlers import base

class Remuxer(base.MuxBase):
    def start(self, args=None):
        q='"'
        self.__inputPath = args['inputPath'].replace('\\','/')
        self.__outputPath = args['outputPath'].replace('\\','/')
        self.__video_track = args['video_track']
        self.__audio_track = args['audio_track']
        self.__inputAudioLang = args['inputAudioLang']
        self.__title = args['title']
    
        #remuxing command and arguements
        self.__command = q + self.mkvMergePath + q + " -o " + q + self.__outputPath + q
        self.__command += ' "--priority" "' + self.priority + '" "--default-track" "1:yes" "--forced-track" "1:no"'
        self.__command += ' "--language" "2:' + self.__inputAudioLang + '" "--default-track" "2:yes" "--forced-track" "2:no" '
        self.__command += '"-a" ' + q + self.__audio_track + q + " "
        self.__command += '"-d" ' + q + self.__video_track + q + " "
        self.__command += '"-S" '
        self.__command += q + self.__inputPath + q + ' "--track-order" "0:' + self.__video_track
        self.__command += ',0:' + self.__audio_track
        self.__command += '" "--title" "'+self.__title+'"'
        
        self.setCommandLine(self.__command)
        self.muxOperation()
